<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.longtop.com/intelliweb" prefix="e"%>
<%@ page isELIgnored="false"%>
<%@page import="com.longtop.framework.common.CacheUtil"%>
<html>
<head>
<title><%=CacheUtil.getConfigValueById("0002")%></title>
</head>

<e:View id="view">
    <script type="text/javascript">SkinUtil.getSkin();</script>
    <script type="text/javascript">SkinUtil.getModuleSkin();</script>
	
	<div id="Invisual Controls" style="min-height: 40px; background-color: LemonChiffon;" >
		<e:Command id="Command_changeRole" action="com.longtop.framework.sys.login.web.LoginAction" method="changeRole" showHintInfoOnSuccess="false">
			<e:Parameter name="roleId"></e:Parameter>
		</e:Command>	
		<e:ListDropDown id="ListDropDown_UserRole" fixed="true" autoDropDown="false" onAfterSelect="ListDropDown_UserRole_onAfterSelect();">
			<e:ListDropDownItem name="ListDropDownItem1" label="切换角色" value=""></e:ListDropDownItem>
		</e:ListDropDown>	
	</div>
	
    <body id="panel">
    <e:Page id="mainpage" style="width:100%;height:100%" action="com.longtop.framework.sys.login.web.MainAction" onAfterLoadPage="ePage_onAfterLoadPage()">
        <table border=0 cellpadding=0 cellspacing=0 width=100% height=100%>
            <!--头部-->
            <tr >
              <td>
               <table  id="headTable" class="head_table" border=0 cellpadding=0 cellspacing=0>
                  <tr id="logotr">
                      <td rowspan=2 ><div class="head_logo"></div></td>
                      <!-- <td width="70%" align="right">
                      <e:Text id="user_role" style="width:67px;" dropDown="ListDropDown_UserRole"></e:Text>&nbsp;&nbsp;
                      <e:Text id="friend_link" style="width:67px;" dropDown="ListDropDown_friendLink"></e:Text>&nbsp;&nbsp;
                      </td>-->
                      <td class="head_title" colspan="2" style="width:350px"></td>
					  <td class="head_button" style="width:350px" colspan="3" nowrap="true">	
							<ul class="m_op">
								<li><e:Text id="Text_userRoleId" style="width:70px;" dropDown="ListDropDown_UserRole"></e:Text></li>
                            	<li><a class="m_op_lk_1" href="javascript: void(0)" onclick="showApplicationSkinMenu(this)" hidefocus="hideFocus">皮肤</a></li>
                     	        <li><a class="m_op_lk_2" href="javascript: window.showModalDialog('jsp/framework/sys/user/changePassword.jsp',null,'dialogWidth=420px;dialogHeight=200px;status=no;scroll=no')">修改密码</a></li>
                                <li><a class="m_op_lk_3" href="javascript:logout()"  hidefocus="hideFocus">注销</a></li>
                            </ul>	
					  </td>
                  </tr>         
                  <tr id="menutr" >
                      <td   id="menutd" colspan="6" class="head_corner">
                          <e:MenuBar id="MenuBar_Apps" menu="main_menu" style="height:23px;border-right:0px;"/>
                      </td>                
                  </tr>
               </table>
              </td>
            </tr>
            <!--提示信息-->
            <tr>
               <td  class="middle">&nbsp;
               	   <e:Image id="Image2" style="vertical-align:bottom;" path="/images/arrow_up.gif" onClick="Arrow_onClick()"></e:Image>
                   <span id="outSpan"></span>&nbsp;
                   <span id="dateSpan"></span>
               </td>
            </tr>
            <!--内容-->
            <tr>
                <td  class="bottom">
                  <e:TabSet id="TabSet_Apps" showBorder="false" tabMode="reference" style="padding-top: 3px;width:100%;height:100%">
                    	<e:Tab name="Tab1" label="我的首页" path="/welcome.jsp" reload="false" allowClose="false" contextRelative="true"/>
                  </e:TabSet>
                </td>
            </tr>
        </table>

      </e:Page> 
	   	<!-- 页面显示菜单 -->
		<e:DataMenu dataset="Dataset_Menu_All" id="main_menu"
                  labelField="menuName" nameField="menuId" showTitlePosition="suspend"
                  parentField="parentMenuId" commandField="command" targetField="target"
                  iconField="imageUrl" indexField="sortNo" pathField="menuUrl"
                  enabledField="isEnabled" visibleField="isVisible" toolTipField="tips"
                  contextRelativeField="isRelativePath" valueField="menuId" 
                  onClickItem="menu_afterItemChange(menu,menuItem)"
                  onRefreshItem="menu_onRefreshItem(menu,menuItem)"/>
                  
		 <e:MenuBar id="MenuBar_Apps_all" menu="main_menu_all" visible="false"/> 
		<!-- 总菜单 -->          
		<e:DataMenu dataset="Dataset_Menu_All" id="main_menu_all"
                  labelField="menuName" nameField="menuId" showTitlePosition="suspend"
                  parentField="parentMenuId" commandField="command" targetField="target"
                  iconField="imageUrl" indexField="sortNo" pathField="menuUrl"
                  enabledField="isEnabled" visibleField="isVisible" toolTipField="tips"
                  contextRelativeField="isRelativePath" valueField="menuId"/>
		
		<e:Dataset id="Dataset_Menu_All" datasetDefinition="DatasetDefinition_sys.dsd" datasetRef="dataset_menu" pageSize="-1" 
				loadDataCommand="Command_Load"  onAfterScroll="Dataset_Menu_onAfterScroll(dataset)">
			<e:Field name="menuId" dataType="string" label="ID" maxLength="32" />
			<e:Field name="menuName" dataType="string" label="NAME" maxLength="200" />
			<e:Field name="parentMenuId" dataType="string" label="PARENT_ID" maxLength="32" />
			<e:Field name="menuUrl" dataType="string" label="URL" maxLength="200" />
			<e:Field name="isRelativePath" dataType="string" label="IS_RELATIVE_PATH" maxLength="1" />
			<e:Field name="imageUrl" dataType="string" label="IMAGE" maxLength="200" />
			<e:Field name="isEnabled" dataType="string" label="IS_ENABLED" maxLength="1" />
			<e:Field name="isVisible" dataType="string" label="IS_VISIBLE" maxLength="1" />
			<e:Field name="target" dataType="string" label="TARGET" maxLength="200" />
			<e:Field name="sortNo" dataType="integer" label="SORT_NO" maxLength="3" />
			<e:Field name="command" dataType="string" label="COMMAND" maxLength="200" />
			<e:Field name="tips" dataType="string" label="TIPS" maxLength="200" />
			<e:Field name="onclick" dataType="string" label="ONCLICK" maxLength="200" />
			<e:Field name="remark" dataType="string" label="REMARK" maxLength="200" />
		</e:Dataset>           
      
      <e:Command id="Command_logout" forward="Forward_login" alwaysPerform="true" action="com.longtop.framework.sys.login.web.MainAction" method="logout"/>
      <e:Forward id="Forward_login"  path="index.jsp"/>
      </body>
  </e:View>
</html>  
<script type="text/javascript">
    //init
	function ePage_onAfterLoadPage(){
			outSpan.innerHTML = "【${sessionScope.sessionObject.orgName}:${sessionScope.sessionObject.roleName}】${sessionScope.sessionObject.userName} (${sessionScope.sessionObject.userId})，欢迎您。";

			var dateSpan = document.getElementById("dateSpan");
			var today = new Date(),date1 = "",date2 = "";
			var year;
			if (today.getDay() == 0)	 date2 = "" + '星期' + '日';
			if (today.getDay() == 1)	 date2 = "" + '星期' + '一';
			if (today.getDay() == 2)	 date2 = "" + '星期' + '二';
			if (today.getDay() == 3)	 date2 = "" + '星期' + '三';
			if (today.getDay() == 4)	 date2 = "" + '星期' + '四';
			if (today.getDay() == 5)	 date2 = "" + '星期' + '五';
			if (today.getDay() == 6)	 date2 = "" + '星期' + '六';

			if (today.getYear() < 2000)
			{
				year = today.getYear() + 1900;
			}
			else
			{
				year = today.getYear();
			}
			date1 = Util.formatDate(today,'yyyy年MM月dd日');
			dateSpan.innerHTML = date1 +"&nbsp;&nbsp;"+ date2;
	}
	
	//点击-是否显示HEADLOGO：
	function Arrow_onClick(){
		var currSkin = Cookie.getValue("appskin");
		var $ = document.getElementById;
		var display = $("logotr").style.display;
		if (display != "none") {
			$("logotr").style.display = "none";
			$("menutd").className = "head_corner2";
			$("headTable").className = "head_table2";
			$("menutr").style.backgroundPosition = "0 -65px";
			$("menutr").style.backgroundImage = "url('styles/"+currSkin+"/main-head-bg.jpg')";
			$J("Image2").setPath("/images/arrow_down.gif");
		} else {
			$("logotr").style.display = "";
			$("menutd").className = "head_corner";
			$("headTable").className = "head_table";	
			$("menutr").style.backgroundImage = "url('')";	
			$J("Image2").setPath("/images/arrow_up.gif");
		}
	}	
		
	function Replace_Date(dates){
		var year = dates.substring(0,4);
		var mon = dates.substring(4,6);
		var day = dates.substring(6,8);
		var re_date = year + '-' + mon + '-' + day;
		return re_date;
	}
	
    //单击菜单
    function menu_afterItemChange(menu,menuItem) {
    	
		if (menuItem && menuItem.getPath() != null && menuItem.getPath() != "") {
			if (menuItem.target != "_blank") {
				TabUtil.openTab(menuItem.name, menuItem.label, menuItem.path, false, menuItem.isRelativePath);
				return true;
			} else {
				window.open(menuItem.path);
				return true;
			}
		}
    }
	//显示页面菜单:若一级菜单有链接，则删除其下的子菜单。
	function menu_onRefreshItem(menu,menuItem){
		//if(menuItem.level==1 && menuItem.getPath() != null && menuItem.getPath() != "")
		if(menuItem.getPath() != null && menuItem.getPath() != ""){
    		menu.removeAllItems(menuItem);
    	}
	}
	
    function logout() {
        MsgBox.showConfirmMsg("您确定要注销吗？","注销确认",[logoutExecute]);
	}

	function logoutExecute() {
		Command_logout.execute();
	}
	
	function showHelp() {
		window.open('help.html');
	}
	
	//切换角色
	function ListDropDown_UserRole_onAfterSelect() {
		var roleId = $J("Text_userRoleId").getValue();
		if(roleId != null && roleId !="") {
			var parameterRoleId = Command_changeRole.parameters.getParameter("roleId");
			parameterRoleId.value = roleId;
			Command_changeRole.execute();
			
			document.location.reload();
		}
	}	
</script>
